public class ThreadDemo9 {

    public static void main(String[] args) throws InterruptedException {
        Object local =new Object();
        Thread t1= new Thread( () -> {

            System.out.println("wait 开始前");
            synchronized (local)
            {
                try {
                    local.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("wait 开始后");
        });

        t1.start();

        Thread.sleep(1000);

        Thread t2=new Thread( () -> {
            System.out.println("notify 开始前");
            synchronized (local)
            {
                local.notify();
            }

            System.out.println("notify 开始后");
        });

        t2.start();
    }
}
